package com.sykj.manage.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sykj.manage.model.BisBusinessOrder;
import com.sykj.manage.service.BisBusinessOrderService;
import com.sykj.util.ManageBody;
import com.sykj.util.PageUtil;

@Controller
@RequestMapping("/bbo")
public class BisBusinessOrderController {
    
	@Autowired
	BisBusinessOrderService bisBusinessOrderSerivce;
	
	@RequestMapping("/list")
	@ResponseBody
	public ManageBody findAll(BisBusinessOrder bisBusinessOrder,Integer offset,Integer pageSize){
		PageHelper.startPage(offset==null?1:PageUtil.getPageNum(offset, pageSize),pageSize==null?10:pageSize,true);
		List<BisBusinessOrder> findAll = bisBusinessOrderSerivce.findAll(bisBusinessOrder);
		PageInfo<BisBusinessOrder>pageInfo = new PageInfo<BisBusinessOrder>(findAll);
		System.out.println("===============================");
		return ManageBody.getData((int)pageInfo.getTotal(),pageInfo.getList(),"");
	}
	
	//id查询详情
	  @RequestMapping("/findByBagId/{order_id}")
	  @ResponseBody
	  public BisBusinessOrder XQ(@PathVariable("order_id")String order_id){
		  //根据id获取所选对象数据
		  BisBusinessOrder findByBagId = bisBusinessOrderSerivce.findByBagId(order_id);
		  System.out.println("=========="+findByBagId);
		return findByBagId;
		  
	  }
	  
	
}
